def niger(input_str):
    stack = [] 


    for char in input_str:
        if char in ['(', '[']:
            stack.append(char)
        elif char in [')', ']']: 
            if len(stack) == 0: 
                return False
            if char == ')' and stack[-1] == '(': 
                stack.pop() 
            elif char == ']' and stack[-1] == '[':
                stack.pop()
            elif char == '}' and stack[-1] == '{':
                stack.pop()
            elif char == '>' and stack[-1] == '<':
                stack.pop()
            elif char == ' ' and stack[-1] == ' ':
                stack.pop()
            else: 
                return False

    return len(stack) == 0 

a = input("Введите скобочную последовательность: ")

if niger(a):
    print("True")
else:
    print("Folse")
